package cal

import (
	"idle/internal/game/attr"
	"idle/internal/game/hero"
)

type BlockAttrCal struct {
}

func (c *BlockAttrCal) Cal(h *hero.Hero) {
	dex := h.GetAttr(attr.Dex)
	baseBlock := h.GetAttr(attr.BaseBlock)
	extBlock := h.GetAttr(attr.ExtBlock)
	lv := h.Lv

	totalBlock := (baseBlock + extBlock) * (dex - 15) / (lv * 2)

	h.SetAttr(attr.Block, totalBlock)

}

func (c *BlockAttrCal) AssociatedAttr() []attr.Attribute {
	return []attr.Attribute{attr.Dex, attr.BaseBlock, attr.ExtBlock}
}
